/* 点卷商城 - 椅子 */

var status = -1;
var itemList = Array(
// -----价格为 60000 点卷 --------
Array(3015193, 5000000), 
Array(3015143, 2000000), 
Array(3015181, 2000000), 
Array(3015144, 1000000), 
Array(3015142, 1000000), 
Array(3015178, 1000000), 
Array(3015100, 1000000), 
Array(3015109, 1000000), 
Array(3015183, 1000000), 
Array(3015197, 1000000), 
Array(3015211, 1000000), 
Array(3012026, 1500000), //绿色时尚转椅
Array(3010002, 60000), //绿色时尚转椅
Array(3010003, 60000), //红色时尚转椅
Array(3010006, 60000), //黄色时尚转椅
Array(3010004, 60000), //黄蓝休闲椅
Array(3010005, 60000), //红蓝休闲椅
Array(3010018, 60000), //椰子树沙滩椅
Array(3010029, 60000), //蓝环凳
Array(3010030, 60000), //黑环凳
Array(3010031, 60000), //红环凳
Array(3010032, 60000), //黄环凳
Array(3010033, 60000), //绿环凳
Array(3010043, 60000), //魔女的飞扫把
Array(3013002, 60000), //烟花祭
Array(3010166, 60000), //双刀同门
// -----价格为 90000 点卷 --------
Array(3010007, 90000), //粉色海豹靠垫
Array(3010008, 90000), //蓝色海豹靠垫
Array(3010010, 90000), //白色海豹靠垫
Array(3010016, 90000), //黑色海豹靠垫
Array(3010017, 90000), //金色海豹靠垫
Array(3010024, 90000), //玩具粉熊椅
Array(3010025, 90000), //枫叶纪念凳
// -----价格为 100000 点卷 --------
Array(3010014, 100000), //月亮弯
Array(3010019, 100000), //寿司椅
Array(3010021, 100000), //暖暖桌
Array(3010034, 100000), //悠长假期(红)
Array(3010035, 100000), //悠长假期(蓝)
Array(3010037, 100000), //猪猪凳
Array(3010038, 100000), //空气沙发
Array(3010040, 100000), //蝙蝠椅
Array(3010041, 100000), //骷髅王座
Array(3010044, 100000), //同一红伞下
Array(3010045, 100000), //寒冰椅子
Array(3010049, 100000), //雪房子
Array(3010068, 100000), //露水椅子
Array(3010050, 100000), //公主凳
Array(3010069, 100000), //大黄风
Array(3010093, 100000), //鲜美的火鸡
Array(3010094, 100000), //漂漂猪椅子
Array(3010095, 100000), //石头人座椅
// -----价格为 100000 点卷 --------
Array(3010009, 100000), //塌塌凳
Array(3010028, 100000), //海盗的俘虏
Array(3010036, 100000), //浪漫秋千
Array(3010046, 100000), //红龙椅
Array(3010047, 100000), //蓝龙椅
Array(3010048, 100000), //圣诞树椅子
Array(3010051, 100000), //沙漠兔子靠垫1
Array(3010052, 100000), //沙漠兔子靠垫2
Array(3010054, 100000), //呼噜呼噜床
Array(3010057, 100000), //血色玫瑰
Array(3010058, 100000), //世界末日
Array(3010071, 100000), //神兽椅
Array(3010073, 100000), //baby品克缤
Array(3010075, 100000), //我为音乐狂
Array(3010077, 100000), //猫头鹰椅子
Array(3010096, 100000), //恐龙化石宝座
Array(3010098, 100000), //电视宅人
Array(3010099, 100000), //北极熊椅子
Array(3010100, 100000), //财神椅子
Array(3010110, 100000), //舒适大白熊椅子
Array(3010111, 100000), //虎虎生威
Array(3010112, 100000), //情书柜子
Array(3010116, 100000), //摇滚之魂椅子
Array(3010117, 100000), //魔法书椅子
Array(3010118, 100000), //糖果音符椅子
Array(3010119, 100000), //羊羊椅子
Array(3010120, 100000), //彩蛋篮子
Array(3010123, 100000), //夏日花朵
Array(3010124, 100000), //都纳斯喷气椅子
Array(3010125, 100000), //尼贝隆战舰椅
Array(3010126, 100000), //蝙蝠魔王座
Array(3012001, 100000), //篝火
Array(3012002, 100000), //浴桶
Array(3010066, 100000), //深蓝色绒毛沙发
Array(3010067, 100000), //红色设计师椅
Array(3010080, 100000), //柿子树鞦韆 
Array(3010081, 100000), //红帽月妙抱枕椅
Array(3010082, 100000), //蓝帽月妙抱枕椅
Array(3010083, 100000), //扇子月妙抱枕椅
Array(3010084, 100000), //太平萧月妙抱枕椅
Array(3010107, 100000), //龙龙的蛋壳椅
Array(3010108, 100000), //幼龙秋千
Array(3010109, 100000), //暖炉椅
Array(3010113, 100000), //幽魂发条熊椅子
Array(3010055, 100000), //冰雪糕丸子椅
Array(3010145, 100000), //周年庆水晶枫叶椅
Array(3010136, 100000), //6周年怪物王座
Array(3010137, 100000), //神龙椅子
Array(3010149, 100000), //咖啡风扇椅
Array(3010144, 100000), //七夕椅子
Array(3010155, 100000), //暗影双刀的猫头鹰
Array(3010078, 100000), //大咖啡椅子
Array(3010132, 100000), //撒娇咖啡椅
Array(3010133, 100000), //帐篷椅
// -----价格为 100000 点卷 --------
Array(3012003, 100000), //爱心椅子
Array(3012006, 100000), //风吹稻香
Array(3012010, 100000), //巧克力蛋糕恋人
Array(3012011, 100000), //我爱巧克力火锅
Array(3010156, 100000), //浮游飞行器
Array(3010152, 100000), //黄三角帐篷椅
Array(3010162, 100000), //果月椅子
Array(3010163, 100000), //满月椅
Array(3010135, 100000), //节日独角兽椅子
Array(3010139, 100000), //私密空间
Array(3010168, 100000), //友谊万岁椅子
Array(3010172, 100000), //星空椅子
Array(3010173, 100000), //万圣节塔罗椅子
Array(3010175, 100000), //名画家椅子
Array(3010179, 100000), //燕尾服咖啡椅
Array(3010169, 100000), //纸箱里(求领养)
Array(3010171, 100000), //过来抱抱椅
Array(3010174, 100000), //女巫炼药椅
Array(3010182, 100000), //兔子家族椅
Array(3010183, 100000), //胡萝卜椅子
Array(3010053, 100000), //兔子纪念版椅子
Array(3010142, 100000), //水族馆椅子
Array(3010209, 100000), //草莓冰淇淋月饼椅
Array(3010210, 100000), //香草冰淇淋月饼椅
Array(3010197, 100000), //英雄的椅子-战神
Array(3010200, 100000), //英雄的椅子-龙神
Array(3010201, 100000), //英雄的椅子-暗影
Array(3010161, 100000), //鼠鼠椅
Array(3010226, 100000), //月光仙子椅子
Array(3010085, 100000), //鬼娃娃椅子
Array(3013000, 100000), //樱花树下
Array(3010177, 100000), //手柄座椅
Array(3010454, 100000), //云朵
Array(3010591, 200000), //漫画书椅子
Array(3010127, 200000), //扎昆宝座
Array(3010128, 200000), //黑龙王椅
Array(3010311, 200000), //黑龙椅子
Array(3010799, 300000), //坟墓幽灵椅子
Array(3010896, 500000), //我的女皇椅子
Array(3010689, 500000), //10周年椅子
Array(3010751, 500000), //鲸鱼椅子
Array(3010752, 500000), //玫瑰鸟笼
Array(3010754, 500000), //百鬼夜行
Array(3012020, 800000), //紫藤花吊篮椅
Array(3010779, 800000), //金马祥云轿
Array(3010783, 1000000), //蓝色邦尼屋
Array(3010876, 1000000), //冒险岛行星椅子
Array(3010696, 1000000), //大黄鸭
Array(3010715, 1000000), //幸福9周年蛋糕气球椅
Array(3010070, 1000000), //巨无霸品克缤
Array(3010828, 1000000), //木星椅子
Array(3010829, 750000), //木星椅子
Array(3010820, 750000), //迷你玩具别墅椅子
Array(3010511, 750000), //咖啡公园椅子
Array(3010516, 750000), //噜噜啦啦印第安小孩
Array(3012016, 750000), //情侣糖果椅子
Array(3010459, 750000), //天使舞台椅
Array(3010196, 750000), //泡泡浴缸椅
Array(3010423, 750000), //蘑菇朋友椅子
Array(3010461, 750000), //赏月专用月桂树秋千椅
Array(3010528, 750000), //跑步机椅子
Array(3010448, 750000), //泡泡浴椅子
Array(3010660, 750000), //梦幻公主城堡椅子
Array(3010714, 750000), //堆王冠
Array(3010835, 750000), //爱情水晶球记忆椅
Array(3010779, 750000), //金马祥云轿
Array(3010702, 500000), //爱琴海椅子
Array(3012019, 750000), //爱琴海椅子
Array(3010842, 750000), //猫猫郊游房车
Array(3010718, 750000), //初恋云朵朵沙发
Array(3010744, 750000), //冒险岛的砖头朋友们
Array(3010594, 750000), //蓝莓蛋糕椅
Array(3012020, 750000), //紫藤花吊篮椅
Array(3010843, 750000), //兔兔郊游房车
Array(3010115, 750000), //熊宝宝床
Array(3010704, 3000000), //惩戒之月妙椅子
Array(3010140, 500000), //早日康复床
Array(3010605, 2500000), //雏祭娃娃3
Array(3014004, 750000), //案件聚焦椅子
Array(3010657, 1000000), //军团长椅子
Array(3010519, 1250000), //巨大白雪人椅子
Array(3010705, 750000), //月妙和水灵椅子
Array(3010401, 750000), //幻影卡牌椅
Array(3010697, 750000), //绝对之椅
Array(3010193, 750000), //伊芙丽思的炼金瓶
Array(3010757, 750000), //你和我
Array(3010603, 750000), //雏祭娃娃1
Array(3010604, 750000), //雏祭娃娃2
Array(3010662, 750000), //章鱼鱼缸椅
Array(3013000, 750000), //樱花树下
Array(3014003, 750000), //封面模特椅子
Array(3010362, 750000), //彩虹椅子
Array(3010760, 750000), //古代浴池椅子
Array(3014000, 750000), //惊人漫画椅子
Array(3010851, 750000), //夏日沁饮椅子
Array(3010723, 750000), //法式贵族扶手椅
Array(3014005, 750000), //荣誉的象征
Array(3010879, 1000000), //咖啡椅子
Array(3010877, 1000000), //人鱼珊瑚礁
Array(3012024, 1000000), //沙滩排球椅子
Array(3015133, 1000000), //亚敏下午茶椅
Array(3010838, 1000000), //冰城堡椅子
Array(3016000, 2000000), //大象跷跷板椅子
Array(3010853, 3000000), //心花怒放椅子
//Array(3010658, 4000000), //夏日西瓜冰椅子
//Array(3010936, 5000000), //青蛙跳楼机
//Array(3015075, 5000000), //大自然椅子
//Array(3010832, 6000000), //太阳椅子
//Array(3010788, 5500000), //巨无霸年夜饭
Array(3015002, 7500000)//七彩摩天轮
//Array(3015051, 10000000) //巨无霸国际巨星

);
var selectedItem = -1;
var selectedCost = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status >= 0) {
            cm.dispose();
            return;
        }
        status--;
    }
    if (status == 0) {
        var selStr = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的道具：";
        for (var i = 0; i < itemList.length; i++) {
            selStr += "\r\n#L" + i + "##i" + itemList[i][0] + ":# #b#t" + itemList[i][0] + "##k   #r" + itemList[i][1] + " #k点卷#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        var item = itemList[selection];
        if (item != null) {
            selectedItem = item[0];
            selectedCost = item[1];
            cm.sendYesNo("您是否购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + " #k 点卷？");
        } else {
            cm.sendOk("出现错误...");
            cm.dispose();
        }
    } else if (status == 2) {
        if (selectedCost <= 0 || selectedItem <= 0) {
            cm.sendOk("购买道具出现错误...");
            cm.dispose();
            return;
        }
        if (cm.getPlayer().getCSPoints(1) >= selectedCost) {
            var gachaponItem = cm.gainGachaponItem(selectedItem, 1, "点卷商店", 3, true);
            if (gachaponItem != -1) {
                cm.gainNX( - selectedCost);
                cm.sendOk("恭喜您成功购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k。");
            } else {
                cm.sendOk("购买失败，请您确认在背包所有栏目窗口中是否有一格以上的空间。");
            }
        } else {
            cm.sendOk("您没有那么多点卷。\r\n\r\n购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷。");
        }
        cm.dispose();
    }
}
